package jp.co.baka.gae.example.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "EA1-SNAPSHOT" }, date = "2010-01-25 23:00:44")
/** */
public final class BbsMessageMeta extends org.slim3.datastore.ModelMeta<jp.co.baka.gae.example.model.BbsMessage> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.co.baka.gae.example.model.BbsMessage> content = new org.slim3.datastore.StringAttributeMeta<jp.co.baka.gae.example.model.BbsMessage>(this, "content", "content");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.lang.Long> id = new org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.lang.Long>(this, "id", "id", java.lang.Long.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.util.Date> insertDate = new org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.util.Date>(this, "insertDate", "insertDate", java.util.Date.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.util.Date> updateDate = new org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.util.Date>(this, "updateDate", "updateDate", java.util.Date.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.co.baka.gae.example.model.BbsMessage> userName = new org.slim3.datastore.StringAttributeMeta<jp.co.baka.gae.example.model.BbsMessage>(this, "userName", "userName");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<jp.co.baka.gae.example.model.BbsMessage, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    /** */
    private static final BbsMessageMeta singleton = new BbsMessageMeta();

    /**
     * @return the singleton
     */
    public static BbsMessageMeta get() {
       return singleton;
    }

    /** */
    public BbsMessageMeta() {
        super("BbsMessage", jp.co.baka.gae.example.model.BbsMessage.class);
    }

    @Override
    public jp.co.baka.gae.example.model.BbsMessage entityToModel(com.google.appengine.api.datastore.Entity entity) {
        jp.co.baka.gae.example.model.BbsMessage model = new jp.co.baka.gae.example.model.BbsMessage();
        model.setContent((java.lang.String) entity.getProperty("content"));
        model.setId((java.lang.Long) entity.getProperty("id"));
        model.setInsertDate((java.util.Date) entity.getProperty("insertDate"));
        model.setKey(entity.getKey());
        model.setUpdateDate((java.util.Date) entity.getProperty("updateDate"));
        model.setUserName((java.lang.String) entity.getProperty("userName"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        jp.co.baka.gae.example.model.BbsMessage m = (jp.co.baka.gae.example.model.BbsMessage) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("content", m.getContent());
        entity.setProperty("id", m.getId());
        entity.setProperty("insertDate", m.getInsertDate());
        entity.setProperty("updateDate", m.getUpdateDate());
        entity.setProperty("userName", m.getUserName());
        entity.setProperty("version", m.getVersion());
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        jp.co.baka.gae.example.model.BbsMessage m = (jp.co.baka.gae.example.model.BbsMessage) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        jp.co.baka.gae.example.model.BbsMessage m = (jp.co.baka.gae.example.model.BbsMessage) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        jp.co.baka.gae.example.model.BbsMessage m = (jp.co.baka.gae.example.model.BbsMessage) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void incrementVersion(Object model) {
        jp.co.baka.gae.example.model.BbsMessage m = (jp.co.baka.gae.example.model.BbsMessage) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePost(com.google.appengine.api.datastore.Entity entity) {
    }

    @Override
    protected void preDelete(com.google.appengine.api.datastore.Entity entity) {
    }

}